Skip to content

feat: add zemo ls to list topics#6

Merged
hidetzu merged 1 commit into
mainfrom
feat/zemo-ls
May 5, 2026
Merged

feat: add zemo ls to list topics#6
hidetzu merged 1 commit into
mainfrom
feat/zemo-ls

Conversation

@hidetzu
Copy link
Copy Markdown
Owner

@hidetzu hidetzu commented May 5, 2026

Summary

Add a zemo ls subcommand that prints topic names from <memo>/topics/ to stdout. The dump-style output (one per line, alphabetical, no .md extension) is feed-back compatible with zemo <topic> and intended to integrate with terminal-side search (e.g. WezTerm QuickSearch) instead of an embedded picker.

Related issue

Closes #3

Changes

  • New Command.ls variant in cli.zig; routed from parseArgs and dispatched in run.
  • New doLs (env → path resolution) and listTopics (path-based, testable) helpers.
  • <memo>/topics/ missing → exit 0 with no output (treated as empty memo).
  • Output filters to *.md files only; subdirectories and other extensions are skipped; trailing .md is stripped from each line.
  • paths.memoDir: convert relative ZEMO_DIR to absolute via std.process.currentPathAlloc. Pre-existing latent bug — Io.Dir.*Absolute calls in openScratch / openTopic / doSync would assert on a relative ZEMO_DIR. Fixed centrally so all commands benefit.
  • README: added zemo ls to Features and Usage sections.
  • HELP_TEXT: added zemo ls line.

Testing

  • zig build test passes locally
  • Manually verified the affected command(s) (zig build run -- ls against ~/memo)
  • Smoke tested relative ZEMO_DIR (ZEMO_DIR=./relmemo zemo ls) — no panic, correct output
  • Cross-build check (if touching platform-specific code): zig build -Dtarget=x86_64-windows / -Dtarget=x86_64-macos

New tests added:

  • parseArgs: ls subcommand — parser-level
  • listTopics: alphabetical order, only .md files — integration test using std.testing.tmpDir and Io.Writer.Allocating to capture output
  • absolutePath: keeps absolute paths / absolutePath: resolves relative paths from cwd — unit tests in paths.zig for the new normalization helper

Notes for reviewers

  • listTopics was extracted from doLs to keep the testable surface path-based (mirrors the resolveMemoDir / memoDir split in paths.zig).
  • The paths.memoDir signature gained an io parameter so it can read cwd; all existing call sites (openScratch / openTopic / doSync) updated accordingly.

@hidetzu hidetzu merged commit d3953d3 into main May 5, 2026
6 checks passed
@hidetzu hidetzu deleted the feat/zemo-ls branch May 6, 2026 00:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: add zemo ls command

1 participant